<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    x:Class="OpenLS.Chart.UI.ScatterChartResources"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:chart="http://schemas.Kherty.com/office/2007/chart"
  xmlns:chartui="clr-namespace:OpenLS.Chart.UI"
  xmlns:Internals="clr-namespace:OpenLS.Chart.UI.Internals">
  <ResourceDictionary.MergedDictionaries>
        <chartui:Axis2DResources/>
  </ResourceDictionary.MergedDictionaries>
  <DataTemplate DataType="{x:Type chart:ScatterChart}">
    <Grid chartui:ChartElement.Chart="{Binding}">
      <chartui:ChartElement.Observer>
        <Binding Converter="{x:Static Internals:ChartConverters.ScatterChartObserverFactory}" Path="Series"/>
      </chartui:ChartElement.Observer>

            <chartui:ChartElement.XAxisInfo>
                <MultiBinding Converter="{x:Static Internals:ChartConverters.AxisInfoFactory}">
                    <Binding Path="HorizontalAxis.Minimum"/>
                    <Binding Path="HorizontalAxis.Maximum"/>
                    <Binding Path="(chartui:ChartElement.Observer).XMinimum" RelativeSource="{RelativeSource Self}"/>
                    <Binding Path="(chartui:ChartElement.Observer).XMaximum" RelativeSource="{RelativeSource Self}"/>
                </MultiBinding>
            </chartui:ChartElement.XAxisInfo>
            <chartui:ChartElement.YAxisInfo>
                <MultiBinding Converter="{x:Static Internals:ChartConverters.AxisInfoFactory}" >
                    <Binding Path="VerticalAxis.Minimum"/>
                    <Binding Path="VerticalAxis.Maximum"/>
                    <Binding Path="(chartui:ChartElement.Observer).YMinimum" RelativeSource="{RelativeSource Self}"/>
                    <Binding Path="(chartui:ChartElement.Observer).YMaximum" RelativeSource="{RelativeSource Self}"/>

                </MultiBinding>
            </chartui:ChartElement.YAxisInfo>
                <chartui:ChartElement.VerticalScaler>
        <MultiBinding Converter="{x:Static Internals:ChartConverters.ScalerFactory}">
          <Binding Path="VerticalAxis.Orientation"/>
          <Binding Path="VerticalAxis.Scaling.LogBase"/>
          <Binding Path="(chartui:ChartElement.YAxisInfo).Minimum" RelativeSource="{RelativeSource Self}"/>
          <Binding Path="(chartui:ChartElement.YAxisInfo).Maximum" RelativeSource="{RelativeSource Self}"/>
        </MultiBinding>
      </chartui:ChartElement.VerticalScaler>
      <chartui:ChartElement.HorizontalScaler>
        <MultiBinding Converter="{x:Static Internals:ChartConverters.ScalerFactory}">
          <Binding Path="HorizontalAxis.Orientation"/>
          <Binding Path="HorizontalAxis.Scaling.LogBase"/>
          <Binding Path="(chartui:ChartElement.XAxisInfo).Minimum" RelativeSource="{RelativeSource Self}"/>
          <Binding Path="(chartui:ChartElement.XAxisInfo).Maximum" RelativeSource="{RelativeSource Self}"/>
        </MultiBinding>
      </chartui:ChartElement.HorizontalScaler>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
        <RowDefinition Height ="Auto"/>
      </Grid.RowDefinitions>
            <ContentPresenter Content="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.PlotArea)}"
                          ContentTemplate="{x:Static chartui:PlotAreaResources.PlotAreaBackgroundTemplate}"
                          Grid.Row="1" Grid.Column="1"/>
            <ContentPresenter 
        Grid.Row="1" Grid.Column="0" Content="{Binding VerticalAxis}"
        chartui:AxisElement.Orientation="Vertical"
        chartui:AxisElement.Minimum="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.YAxisInfo).Minimum}"
        chartui:AxisElement.Maximum="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.YAxisInfo).Maximum}">
            </ContentPresenter>
                <ContentPresenter HorizontalAlignment="Stretch"
                    Grid.Row="2" Grid.Column="1" Content="{Binding HorizontalAxis}"
        chartui:AxisElement.Orientation="Horizontal"
        chartui:AxisElement.Minimum="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.XAxisInfo).Minimum}"
        chartui:AxisElement.Maximum="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.XAxisInfo).Maximum}">
                </ContentPresenter>

            <Grid Grid.Row="1" Grid.Column="1" 
                chartui:AxisElement.Minimum="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.XAxisInfo).Minimum}"
                chartui:AxisElement.Maximum="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.XAxisInfo).Maximum}"
                  chartui:AxisElement.Orientation="Horizontal">
                <ContentPresenter  Name="minorHorizontalGrid">
                    <chartui:AxisElement.MinorStep>
                        <MultiBinding Converter="{x:Static Internals:ChartConverters.MinMaxToMinorStepConverter}">
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Minimum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Maximum)"/>
                        </MultiBinding>
                    </chartui:AxisElement.MinorStep>
                    <ContentPresenter.Content>
                        <MultiBinding Converter="{x:Static Internals:ChartConverters.MinMaxToMinorInfoConverter}">
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Minimum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Maximum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.MinorStep)"/>
                            <Binding Path="HorizontalAxis"/>
                            <Binding Path="HorizontalAxis.MinorGridLines"/>
                        </MultiBinding>
                    </ContentPresenter.Content>
                </ContentPresenter>
                <ContentPresenter Name="majorHorizontalGrid">
                    <chartui:AxisElement.MajorStep>
                        <MultiBinding Converter="{x:Static Internals:ChartConverters.MinMaxToMajorStepConverter}">
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Minimum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Maximum)"/>
                        </MultiBinding> 
                    </chartui:AxisElement.MajorStep>
                    <ContentPresenter.Content>
                        <MultiBinding Converter="{x:Static Internals:ChartConverters.MinMaxToMajorInfoConverter}">
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Minimum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Maximum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.MajorStep)"/>
                            <Binding Path="HorizontalAxis"/>
                            <Binding Path="HorizontalAxis.MajorGridLines"/>
                        </MultiBinding>
                    </ContentPresenter.Content>
                </ContentPresenter>
            </Grid>

            <Grid Grid.Row="1" Grid.Column="1" 
                chartui:AxisElement.Minimum="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.YAxisInfo).Minimum}"
                chartui:AxisElement.Maximum="{Binding RelativeSource={RelativeSource Self}, Path=(chartui:ChartElement.YAxisInfo).Maximum}"
                  chartui:AxisElement.Orientation="Vertical">
                <ContentPresenter  Name="minorVerticalGrid">
                    <chartui:AxisElement.MinorStep>
                        <MultiBinding Converter="{x:Static Internals:ChartConverters.MinMaxToMinorStepConverter}">
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Minimum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Maximum)"/>
                        </MultiBinding>
                    </chartui:AxisElement.MinorStep>
                    <ContentPresenter.Content>
                        <MultiBinding Converter="{x:Static Internals:ChartConverters.MinMaxToMinorInfoConverter}">
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Minimum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Maximum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.MinorStep)"/>
                            <Binding Path="VerticalAxis"/>
                            <Binding Path="VerticalAxis.MinorGridLines"/>
                        </MultiBinding>
                    </ContentPresenter.Content>
                </ContentPresenter>
                <ContentPresenter Name="majorVerticalGrid">
                    <chartui:AxisElement.MajorStep>
                        <MultiBinding Converter="{x:Static Internals:ChartConverters.MinMaxToMajorStepConverter}">
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Minimum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Maximum)"/>
                        </MultiBinding>
                    </chartui:AxisElement.MajorStep>
                    <ContentPresenter.Content>
                        <MultiBinding Converter="{x:Static Internals:ChartConverters.MinMaxToMajorInfoConverter}">
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Minimum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.Maximum)"/>
                            <Binding RelativeSource="{RelativeSource Self}" Path="(chartui:AxisElement.MajorStep)"/>
                            <Binding Path="VerticalAxis"/>
                            <Binding Path="VerticalAxis.MajorGridLines"/>
                        </MultiBinding>
                    </ContentPresenter.Content>

                </ContentPresenter>
            </Grid>
            <ItemsControl Name="scatterSeries" Grid.Row="1" Grid.Column="1" ItemsSource="{Binding Path=Series}" ToolTip="{x:Static Internals:UIStringTable.PlotArea}">
        <ItemsControl.ItemsPanel>
          <ItemsPanelTemplate>
            <Grid/>
          </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
      </ItemsControl>
    </Grid>
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding ScatterStyle}" Value="{x:Static chart:ScatterStyle.None}">
                <Setter TargetName="scatterSeries" Property="ItemsSource" Value="{x:Null}"/>
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>

</ResourceDictionary>